// ===============================================
// json_map_to_list
//
// Create by 令狐冲 on 24/7/2023 16:08
// Copyright @guoqi.All rights reserved.
// ===============================================

import 'package:json_annotation/json_annotation.dart';

class DynamicToList implements JsonConverter<List<dynamic>, dynamic> {
  const DynamicToList();

  @override
  List<dynamic> fromJson(dynamic json) {
    if (json == null) {
      return <dynamic>[];
    } else if (json is Map) {
      return <dynamic>[];
    } else if (json is String) {
      return <dynamic>[];
    } else if (json is int) {
      return <dynamic>[];
    }
    return json as List<dynamic>;
  }

  @override
  List<dynamic> toJson(dynamic object) {
    if (object == null) {
      return <dynamic>[];
    } else if (object is Map) {
      return <dynamic>[];
    } else if (object is String) {
      return <dynamic>[];
    }
    return object as List<dynamic>;
  }
}
